﻿@using HopNguyenModel
@model HopNguyenModel.TypeContent
@{
    ViewBag.Title = "Sửa " + Model.Name;
    Layout = "~/Views/Shared/_BackendLayout.cshtml";
    List<TypeContent> lstTypeProduct = ViewBag.lstTypeProduct;
}

<div class="page-header position-relative">
    <h1>Sửa: @Model.Name
    </h1>
</div>
<!--/.page-header-->
<div class="row-fluid">
    <div class="tabbable">
        <ul class="nav nav-tabs" id="myTab">
            <li class="active">
                <a data-toggle="tab" href="#tab1">
                    <i class="green icon-home bigger-110"></i>
                    Thông tin chung
                </a>
            </li>
            <li>
                <a data-toggle="tab" href="#tab2">SEO Option
                </a>
            </li>
        </ul>
        <form id="validate" action="/cpanel/edittypeproduct" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="Id" value="@Model.Id"/>
            <div class="tab-content">
                @if (ViewBag.msg == "success")
                {
                    <div class="alert alert-success">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>Thành công!</strong> Cập nhật thành công.
                    </div>
                }
                @if (ViewBag.Error != null)
                {
                    <div class="alert alert-error">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>Lỗi!</strong> @ViewBag.Error
                    </div>
                }
                <div class="tab-pane active" id="tab1">
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Nhóm cha</span>
                            </div>
                            <div class="span9">
                                <div class="noSearch">
                                    @Html.DropDownList("Parent", null, "Root", new { @class = "chzn-select" })
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Tên loại sản phẩm</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="name" value="@Model.Name">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Hình ảnh</span>
                            </div>
                            <div class="span3">
                                <input type="file" name="image" id="id-input-file-2">
                                <img src="@Model.Image" width="100px" height="80px"/>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Trạng thái</span>
                            </div>
                            <div class="span9">
                                <div class="noSearch">
                                    <select class="chosen" name="Status">
                                        <option@(Model.Status == true ? " checked=checked" : "") value="True">Hiện</option>
                                        <option@(Model.Status == false ? " checked=checked" : "") value="False">Ẩn</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Sắp xếp</span>
                            </div>
                            <div class="span9">
                                <input type="number" name="Sort" value="@Model.Sort">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span12">
                                <strong>Mô tả</strong>
                                <textarea name="summary" class="ckeditor">@Model.Summary</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="tab2">
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Title</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="MetaTitle" value="@Model.MetaTitle">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Keyword</span>
                            </div>
                            <div class="span9">
                                <input type="text" name="MetaKeyword" value="@Model.MetaKeyword">
                            </div>
                        </div>
                    </div>
                    <div class="formField">
                        <div class="row-fluid">
                            <div class="span2">
                                <span class="fLabel">Meta Description</span>
                            </div>
                            <div class="span9">
                                <textarea name="MetaDescription" rows="4">@Model.MetaDescription</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="formButtons">
                    <div class="row-fluid">
                        <div class="span2"></div>
                        <div class="span9">
                            <button class="btn btn-info" type="submit">
                                <i class="icon-ok bigger-110"></i>
                                Cập nhật
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="row-fluid">
    <div class="choose-type">
            <div class="span2">
                <a href="/Cpanel/CreateTypeProduct" class="btn btn-primary">Tạo mới</a>
            </div>
            <div class="span4">
                <strong>Lọc nhóm cha</strong> @Html.DropDownList("Parent", null, "[No filter]", new { onchange = "parentchange(this.value)" })
            </div>
        </div>
</div>
<div class="row-fluid">
    
    <table id="tbl-sort-asc" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th class="center">Mã</th>
                <th style="text-align: left">Tên</th>
                <th>Danh mục</th>
                <th class="center">Trạng thái</th>
                <th class="center">Sắp xếp</th>
                <th class="center">Ngày tạo</th>
                <th class="center">Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in lstTypeProduct)
            {
                <tr>
                    <td class="center">@item.Id</td>
                    <td style="text-align: left"><a href="/cpanel/edittypeproduct/@item.Id">@item.Name</a></td>
                    <td>@(item.TypeContent2 != null ? item.TypeContent2.Name : "root")</td>
                    <td class="center">@(item.Status == true ? Html.Raw("<span class=\"label label-success arrowed\">Hiện</span>") : Html.Raw("<span class=\"badge badge-important\">Ẩn</span>"))</td>
                    <td class="center">@item.Sort</td>
                    <td class="center">@item.DateCreate</td>
                    <td class="center">
                        <a href="/cpanel/edittypeproduct/@item.Id" title="Sửa">Sửa</a> | 
                            <a href="/cpanel/deletetypeproduct/@item.Id" onclick="javascript:return confirm('Are you sure?');" title="Xóa">Xóa</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
